package utils;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

public class UserContext {

    public static final String USER_IN_SESSION = "user_in_session";

    private static HttpSession getSession(){
        HttpServletRequest request =((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        return request.getSession();
    }

//    public static void setLoginUser(LoginInfo loginInfo){
//        getSession().setAttribute(USER_IN_SESSION,loginInfo);
//    }
//
//    public static LoginInfo getLoginUser(){
//        return (LoginInfo) getSession().getAttribute(USER_IN_SESSION);
//    }
}
